# import requests
#
# # 手机号码格式不正确
# env = "http://192.168.0.103:8088/"
# url = env + "futureloan/mvc/api/member/register"
#
# for i in range(0, 10):
#       for j in range(0, 10):
#             for k in range(0, 10):
#                   try:
#                         cs = {"Mobilephone": "%d%d%d56989230" % (i, j, k),
#                               "pwd": "1234567", "regname": "草莓熊"}
#                         r = requests.get(url, params=cs)
#                         print(r.text)
#                         print("%d%d%d" % (i, j, k))
#
#                         assert r.json()['status'] == 0
#                         assert r.json()['code'] == "20109"
#                         assert r.json()['msg'] == "手机号码格式不正确"
#
#                         with open(r"C:\ApiAuto Test46\day01\zc.txt","a",encoding="utf-8") as file:
#                               file.write( "%d%d%d56989230" % (i, j, k) + '\n')
#                   except AssertionError as e:
#                         print("断言失败%d%d%d"%(i,j,k))
#                         with open(r"C:\ApiAuto Test46\day01\yc.txt","a",encoding="utf-8") as file:
#                               file.write("%d%d%d56989230" % (i, j, k) + '\n')
#                   except Exception as e :
#                         print("断言失败%d%d%d" % (i, j, k))
#
#
# #
# cs = {"Mobilephone":"1111111111",
#       "pwd":"1234567",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# # print(r.text)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20109"
# assert r.json()['msg'] == "手机号码格式不正确"
#
# # 2
# cs = {"Mobilephone":"111111111223",
#       "pwd":"1234567",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# # print(r.text)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20109"
# assert  r.json()['msg'] == "手机号码格式不正确"
#
# # 3
# cs = {"Mobilephone":"10223456789",
#       "pwd":"1234567",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20109"
# assert  r.json()['msg'] == "手机号码格式不正确"
#
# # 4
# cs = {"Mobilephone":"11223456789",
#       "pwd":"1234567",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20109"
# assert  r.json()['msg'] == "手机号码格式不正确"
#
# # 5
# cs = {"Mobilephone":"12223456789",
#       "pwd":"1234567",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20109"
# assert  r.json()['msg'] == "手机号码格式不正确"
#
# # 6
# cs = {"Mobilephone":"14223456789",
#       "pwd":"1234567",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20109"
# assert  r.json()['msg'] == "手机号码格式不正确"
#
# # 5
# cs = {"Mobilephone":"17223456789",
#       "pwd":"1234567",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20109"
# assert  r.json()['msg'] == "手机号码格式不正确"
#
#
# # 3
# cs = {"Mobilephone":"znns张ds",
#       "pwd":"1234567",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20109"
# assert  r.json()['msg'] == "手机号码格式不正确"
#
# # 手机号码已被注册
# cs = {"Mobilephone":"18023456789",
#       "pwd":"1234567",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20110"
# assert  r.json()['msg'] == "手机号码已被注册"
#
# # 参数错误：参数不能为空（有问题）
# cs = {"pwd":"1234567",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# print(r.text)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20103"
# assert r.json()['msg'] == "手机号不能为空"
#
# #手机号注册成功用例（有问题）
# # cs = {"Mobilephone":"18023455556",
# #       "pwd":"1234567",
# #       "regname":"草莓熊"}
# # r = requests.get(url,params=cs)
# # print(r.text)
# # assert r.json()['status'] == 1
# # assert r.json()['code'] == "10001"
# # assert r.json()['msg'] == "注册成功"
#
#
# # 密码长度必须为6~18
# # cs = {"Mobilephone":"18023455556",
# #       "pwd":"12345",
# #       "regname":"草莓熊"}
# cs = {"Mobilephone":"18023455556",
#       "pwd":"12345678901234567890",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# print(r.text)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20108"
# assert r.json()['msg'] == "密码长度必须为6~18"
#
#
# # 参数错误：参数不能为空(有问题)
# cs = {"Mobilephone":"18023455556",
#       "pwd":"",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# print(r.text)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20103"
# assert r.json()['msg'] == "密码不能为空"
#
# # 成功(有问题)
# cs = {"Mobilephone":"18023424389",
#       "pwd":"123456789",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# print(r.text)
# assert r.json()['status'] == 1
# assert r.json()['code'] == "10001"
# assert r.json()['msg'] == "注册成功"
#
# # 成功(有问题)
# cs = {"Mobilephone":"18023424389",
#       "pwd":"123456789",
#       "regname":"草莓熊"}
# r = requests.get(url,params=cs)
# print(r.text)
# assert r.json()['status'] == 1
# assert r.json()['code'] == "10001"
# assert r.json()['msg'] == "注册成功"
#
#
#
#
# env = "http://192.168.1.125:8088/"
# url = env + "futureloan/mvc/api/member/login"
# cs = {"Mobilephone":"18934434567",
#       "pwd":"12345"}
# r = requests.get(url,params=cs)
# # print(r.text)
# assert r.json()['status'] == 0
# assert r.json()['code'] == "20111"
# assert r.json()['msg'] == "用户名或者密码错误"
#


import pymysql


def connect(db_info: dict):
    '''

    :param db_info:
    :return:
    '''
    try:
        conn = pymysql.connect(user=None,
                               password="",
                               host=None,
                               database=None,
                               port=0,
                               charset="")
        print("连接数据库可成功")
        return conn
    except Exception as e:
        print("数据库异常，异常信息为；",{e})
